package apis.article;

import apis.article.fallback.ArticleClientFallBack;
import com.heima.model.article.dtos.ApArticleCommentDto;
import com.heima.model.article.dtos.ApArticleOpenCommentDto;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.article.pojos.ApArticleConfig;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.vos.SearchArticleVo;
import com.heima.model.wemedia.dtos.CommentDto;
import com.heima.model.wemedia.dtos.ManageDto;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.dtos.CommentPageDto;
import com.heima.model.wemedia.dtos.StatisticsDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

import java.util.List;

@FeignClient(value = "leadnews-article", fallback = ArticleClientFallBack.class)
public interface IArticleClient {
    @PostMapping("/api/v1/article/save")
    ResponseResult saveOrUpdateArticle(@RequestBody ArticleDto articleDto);

    @PostMapping("/api/v1/article")
    ResponseResult<SearchArticleVo> selectESVoById(@RequestBody Long id);


    /**
     * @description: 查询上架的文章评论概览
     * @param:
     * @return: java.util.List<com.heima.model.wemedia.pojos.WmNews>
     * @author: liyong
     * @date: 2023/06/28 16:49
     */
    @PostMapping("/api/v1/article/pageCommentArticle")
    PageResponseResult pageCommentArticle(@RequestBody ManageDto dto);


    /**
     * @description: 修改评论开启关闭状态
     * @param: dto
     * @return: com.heima.model.common.dtos.ResponseResult
     * @author: liyong
     * @date: 2023/06/28 21:39
     */
    @PostMapping(value = "/api/v1/article/updateStatus")
    ResponseResult updateStatus(@RequestBody CommentDto dto);

    @PostMapping("/api/v1/article/findNewsComment")
    ResponseResult findArticleComment(@RequestBody ApArticleCommentDto apArticleCommentDto);

    @PostMapping("/api/v1/article/openComment")
    ResponseResult openComment(@RequestBody ApArticleOpenCommentDto apArticleOpenCommentDto);

    @GetMapping("/api/v1/article/queryLikesAndConllections")
    ResponseResult queryLikesAndConllections(@RequestParam("wmUserId") Integer wmUserId, @RequestParam("beginDate") Date beginDate, @RequestParam("endDate") Date endDate);

    @PostMapping("/api/v1/article/newPage")
    PageResponseResult newPage(@RequestBody StatisticsDto dto);

    @PostMapping("/api/v1/article/pagecomment")
    PageResponseResult findNewsComments(@RequestBody CommentPageDto dto);


    @GetMapping("/getconfig")
     ResponseResult<ApArticleConfig> getConfig(Long articleId);
}


